package org.openstack.service.auth;

import org.openstack.api.auth.AuthService;
import org.openstack.model.auth.Authentication;
import org.openstack4j.api.OSClient.OSClientV3;

/**
 * 验证工厂
 * <p>
 * Created by jiyun on 2017/8/28.
 */
public class AuthFactory implements AuthService {

    /**
     * 通过配置文件 auth.properties 验证
     *
     * @return 返回通过验证的客户端实例
     */
    @Override
    public OSClientV3 auth() {
        return AuthOS.getOSClient();
    }

    /**
     * 通过传入验证实例参数验证
     *
     * @param user 验证实例
     * @return 返回通过验证的客户端实例
     */
    @Override
    public OSClientV3 auth(Authentication user) {
        return AuthOS.getOSClient(user);
    }
}
